﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DTO;
using BUS;

namespace WebSieuThi.QuanLi.QuanLiHangAjax
{
    public partial class themhang : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        //    int id = int.Parse(Request.QueryString["id"].ToString());

            string mahang = Request.QueryString["mahang"].ToString();
            string tenhang = Request.QueryString["tenhang"].ToString();
            int idmaloai = int.Parse(Request.QueryString["idmaloai"].ToString());
            int dongia = int.Parse(Request.QueryString["dongia"].ToString());
            int tonkho = int.Parse(Request.QueryString["tonkho"].ToString());
            int quay = int.Parse(Request.QueryString["quay"].ToString());

            HangHoa hang = new HangHoa();

            hang.MaHH = mahang;
            hang.TenHangHoa = tenhang;
            hang.IdMaLoaiHang = idmaloai;
            hang.DonGia = dongia;
            hang.SoLuongTonKho = tonkho;
            hang.SoLuongTaiQuay = quay;

            bool b = HangHoaBUS.Them(hang);

            if (b)
            {
                Response.Write("Thêm thành công!");
            }
            else
            {
                Response.Write("Xãy ra lỗi khi thêm hàng hóa! Không thêm được hàng hóa này.");
            }
        }
    }
}
